package com.jsle.financial.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @Title: DateUtil.java
 * @Description: <br>
 *               <br>
 * @Created on Nov 1, 2012 11:12:24 PM
 * @author lixbh
 * @version $Revision: 1.1.2.2 $
 * @since 1.0
 */
public class DateUtil {
    private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

    public static Date parse(String dateString) {
	try {
		System.out.println("dateString:::"+dateString);
	    return dateFormat.parse(dateString);
	} catch (ParseException e) {
	    e.printStackTrace();
	}

	return null;
    }

    public static String format(Date date) {
    	return dateFormat.format(date);
    }
    
    public static Date getBefore3Day(Date date){
    	Calendar c = Calendar.getInstance();
		c.setTime(new Date());
		c.add(Calendar.DATE, -3);
		return c.getTime();
    }
}
